package com.nthink.indicators.service.qualitymanagement.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nthink.indicators.mapper.qualitymanagement.BaseIndexMapper;
import com.nthink.indicators.pojo.qualitymanagement.BaseIndex;
import com.nthink.indicators.service.qualitymanagement.BaseIndexService;
import org.springframework.stereotype.Service;

import java.util.Date;


@Service
public class BaseIndexServiceImpl extends ServiceImpl<BaseIndexMapper, BaseIndex> implements BaseIndexService {

    @Override
    public BaseIndex getBaseIndex(Date startTime, Date endTime) {
        BaseIndex baseIndex = new BaseIndex();
        baseIndex.setNoOperationPatientCount(baseMapper.getNoOperationPatientCount(startTime, endTime));
        baseIndex.setInPatientCount(baseMapper.getInPatientCount(startTime, endTime));
        baseIndex.setDeathPatientCount(baseMapper.getDeathPatientCount(startTime, endTime));
        baseIndex.setInRegAgainCount(baseMapper.getInRegAgainCount(startTime, endTime));
        baseIndex.setAvgInDays(baseMapper.getAvgInDays(startTime, endTime));
        baseIndex.setAvgInTotalFee(baseMapper.getAvgInTotalFee(startTime, endTime));
        baseIndex.setOperationCount(baseMapper.getOperationCount(startTime, endTime));
        baseIndex.setOperationDeathCount(baseMapper.getOperationDeathCount(startTime, endTime));
        baseIndex.setAvgDaysBeforeOperation(baseMapper.getAvgDaysBeforeOperation(startTime, endTime));
        baseIndex.setOperationPatientAvgFee(baseMapper.getOperationPatientAvgFee(startTime, endTime));
        return baseIndex;
    }
}